<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class LaborBlack extends Model
{
    use HasFactory;

    protected $fillable = [
        'labor_id',
        'company_id',
        'reason',
        'start_date',
        'end_date',
        'admin_id',
    ];
    const POSTONLY = [
        'labor_id',
        'company_id',
        'reason',
        'start_date',
        'end_date',
        'admin_id',
    ];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function labor()
    {
        return $this->belongsTo(Labor::class);
    }

    // 关联创建人
    public function admin()
    {
        return $this->belongsTo(Admin::class);
    }
}
